package com.kky.pp.activity.fc
import android.view.LayoutInflater
import android.widget.ImageView
import android.widget.TextView
import androidx.constraintlayout.widget.ConstraintLayout
import com.kky.pp.R
import com.kky.pp.util.DensityUtil
import com.custom.base.mvp.MVPBaseActivity
import com.gyf.immersionbar.ImmersionBar
import com.kky.pp.databinding.ActivityUserFlashchatBinding
import io.rong.imkit.utils.StatusBarUtil


class FlashChatActivity : MVPBaseActivity<FlashChatContract.ChatView, FlashChatPresenter,ActivityUserFlashchatBinding>(ActivityUserFlashchatBinding::inflate),
    FlashChatContract.ChatView {

    override fun setFullScreen(): Boolean {
        return true
    }

    override fun bindLayout(): Int {
        return R.layout.activity_user_flashchat
    }

    override fun initView() {
//        initAnimate(
//            flashChatUserTitle,
//        )

        (viewBinding.imgViewUserQuickChatCancel.layoutParams as ConstraintLayout.LayoutParams).setMargins(0,StatusBarUtil.getStatusBarHeight(mActivity),0,0)

    }

    override fun onDestroy() {
        super.onDestroy()
    }

    override fun onResume() {
        super.onResume()
        ImmersionBar.with(mActivity).statusBarDarkFont(false).init()
    }
    
    private fun initAnimate(
        flashChatUserTitle: TextView,
    ) {
        val screesWidth = DensityUtil.getScreenWidth(mActivity)
        val screesHeight =
            DensityUtil.getScreenHeight(mActivity) - StatusBarUtil.getStatusBarHeight(mActivity)
        val userAvatarHeiht = screesWidth - DensityUtil.dp2px(mActivity, 118f)
        val flashChatUserTitleTop =
            screesHeight / 2 - userAvatarHeiht / 2
        flashChatUserTitle.animate()
            ?.translationY(flashChatUserTitleTop.toFloat())
            ?.setDuration(800)?.alpha(1.0f)?.start()
    }

    override val txtUserQuickChatTitles: TextView
        get() = viewBinding.txtUserQuickChatTitle
    override val imgViewUserQuickChatHeads: ImageView
        get() = viewBinding.imgViewUserQuickChatHead
    override val imgViewUserQuickChatSends: ImageView
        get() = viewBinding.imgViewUserQuickChatSend
    override val imgViewUserQuickChatCancels: ImageView
        get() = viewBinding.imgViewUserQuickChatCancel

}